package com.usth.service;

import java.util.Map;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.usth.model.User;

	public class SessionIterceptor extends AbstractInterceptor {  
		  
	    @Override  
	    public String intercept(ActionInvocation actionInvocation) throws Exception {  
	        ActionContext ctx = ActionContext.getContext();  
	        Map session = ctx.getSession();  
	        User user=  (User) session.get("user");  
	        if (user == null) {  
	            return Action.LOGIN;  
	        } else {  
	            return actionInvocation.invoke();  
	        }  
	    }  
	  
	}  